package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tech.aistar.entity.Show;

import java.util.List;

/**
 * 本类用来演示:
 *
 * @author jyz
 * @date 2023/3/4 15:21:53
 */
@Repository
public interface ShowMapper {

    //查找全部
    @Select("select * from mm_show")
    List<Show> findAll();

    //通过id查找全部信息
    @Select("select * from mm_show where id=#{id}")
    Show getShow(int id);

    //通过id进行删除
    @Delete("delete from mm_show where id=#{id}")
    int delete (int id);

    //增
    @Insert("insert into mm_show (id,film,cinema_id,showdate,showTime,price)values(#{id},#{film},#{cinema_id},#{showdate},#{showTime},#{price})")
    int save(Show show);

    //更新
    @Update("update mm_show set id=#{id},film=#{film},cinema_id=#{cinema_id},showdate=#{showdate},showTime=#{showTime},price=#{price}")
    int update(Show show);

}
